from 火车票刷票.控制台_12306车票信息 import city

class train ():
    def __init__(self):

        pass

    def get_information(self):
        def getlist(date) -> object:
            # date = input('你要查询的日期(格式:1111-22-33):')
            try:
                from_station = city[input('请输入出发站:')]
                to_station = city[input('请输入到达站:')]
            except:
                print('这个城市没有找到,请重新输入:')
                getlist(date_now)
            data0 = urllib.request.urlopen(
                f"https://kyfw.12306.cn/otn/leftTicket/query?leftTicketDTO.train_date={date}&leftTicketDTO.from_station={from_station}&leftTicketDTO.to_station={to_station}&purpose_codes=ADULT", ).read()
            data1 = json.loads(data0)
            return data1['data']

